﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace Reviewer.Entities.Services
{

    /// <summary>
    /// Game Service Interface
    /// </summary>
    [ServiceContract(Namespace = "Reviewer.Services")]
    public interface IGameService : IDisposable
    {
        /// <summary>
        /// Gets all games.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Game[] GetAll();
        /// <summary>
        /// Gets game by the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        [OperationContract]
        Game GetBy(Int32 id);
        /// <summary>
        /// Gets game by the specified game id.
        /// </summary>
        /// <param name="gameId">The game id.</param>
        /// <returns></returns>
        [OperationContract]
        Game[] GetBy(Guid gameId);

        /// <summary>
        /// Gets the associalted top image.
        /// </summary>
        /// <param name="gameId">The game id.</param>
        /// <returns></returns>
        [OperationContract]
        GameTopImage GetAssociatedTopImage(Guid gameId);

        /// <summary>
        /// Gets the associated screenshots.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        GameScreenshot[] GetAssociatedScreenshots(Guid gameId);

        /// <summary>
        /// Gets the associated video.
        /// </summary>
        /// <param name="gameId">The game id.</param>
        /// <returns></returns>
        [OperationContract]
        GameVideo GetAssociatedVideo(Guid gameId);

        /// <summary>
        /// Gets the latest videos.
        /// </summary>
        /// <param name="topCount">The top count.</param>
        /// <returns></returns>
        [OperationContract]
        GameVideo[] GetLatestVideos(int topCount);

        /// <summary>
        /// Finds the games with missing screenshots.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Game[] FindGamesWithMissingScreenshots();

        /// <summary>
        /// Finds games by title.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <returns></returns>
        [OperationContract]
        Game[] FindGamesByTitle(string title);

        /// <summary>
        /// Gets all by news relation.
        /// </summary>
        /// <param name="newsId">The news id.</param>
        /// <returns></returns>
        [OperationContract]
        Game[] GetAllByNewsRelation(Guid newsId);

        /// <summary>
        /// Searches the specified title search.
        /// </summary>
        /// <param name="titleSearch">The title search.</param>
        /// <param name="format">The format.</param>
        /// <param name="maxResults">The max results.</param>
        /// <returns></returns>
        [OperationContract]
        ICollection<Game> Search(string titleSearch, Int32? format, int maxResults);

        /// <summary>
        /// Searches the future releases.
        /// </summary>
        /// <param name="releaseMonth">The release month.</param>
        /// <param name="format">The format.</param>
        /// <param name="maxResult">The max result.</param>
        /// <returns></returns>
        [OperationContract]
        ICollection<Game> SearchFutureReleases(Int32? releaseMonth, Int32? format, int maxResults);

        /// <summary>
        /// Gets the rating.
        /// </summary>
        /// <param name="gameId">The game id.</param>
        /// <returns></returns>
        [OperationContract]
        ICollection<PEGIRating> GetRatings(Guid gameId);

        /// <summary>
        /// Find games by release date
        /// </summary>
        /// <param name="month">Release date month</param>
        /// <param name="year">Release date year</param>
        /// <returns>List of games to be released within the specified month and quater and year</returns>
        Game[] FindGamesByReleaseDate(int month, int year);

        [OperationContract]
        GameFactsheet GetFactsheet(Guid gameId);
    }

    /// <summary>
    /// Game administration service interface
    /// </summary>
    [ServiceContract]
    public interface IGameAdminService : IDisposable
    {
        /// <summary>
        /// Deletes a game with the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        [OperationContract]
        void Delete(Guid id);

        /// <summary>
        /// Saves the specified game.
        /// </summary>
        /// <param name="game">The game.</param>
        /// <returns></returns>
        [OperationContract]
        Game[] Save(Game game);

        /// <summary>
        /// Saves the specified games.
        /// </summary>
        /// <param name="games">The games.</param>
        /// <returns></returns>
        [OperationContract]
        Game[] Save(Game[] games);

        /// <summary>
        /// Sets the associated top image.
        /// </summary>
        /// <param name="image">The image.</param>
        [OperationContract]
        void SetAssociatedTopImage(GameTopImage image);

        /// <summary>
        /// Adds the associated screenshots.
        /// </summary>
        /// <param name="screenshots">The screenshots.</param>
        [OperationContract]
        void AddAssociatedScreenshots(GameScreenshot[] screenshots);

        /// <summary>
        /// Adds the associated screenshot.
        /// </summary>
        /// <param name="screenshot">The screenshot.</param>
        [OperationContract]
        void AddAssociatedScreenshot(GameScreenshot screenshot);

        /// <summary>
        /// Deletes the associated screenshot by.
        /// </summary>
        /// <param name="id">The id.</param>
        [OperationContract]
        void DeleteAssociatedScreenshotBy(int id);

        /// <summary>
        /// Deletes the associated screenshots by filename.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        [OperationContract]
        void DeleteAssociatedScreenshotsBy(string fileName);

        /// <summary>
        /// Sets the associated video.
        /// </summary>
        /// <param name="video">The video.</param>
        [OperationContract]
        void SetAssociatedVideo(GameVideo video);

        /// <summary>
        /// Clears the associated video.
        /// </summary>
        /// <param name="gameId">The game id.</param>
        [OperationContract]
        void ClearAssociatedVideo(Guid gameId);

        /// <summary>
        /// Sets the rating.
        /// </summary>
        /// <param name="rating">The rating.</param>
        [OperationContract]
        void SetRatings(Guid gameId, ICollection<PEGIRating> ratings);

        [OperationContract]
        GameFactsheet SetFactsheet(GameFactsheet factsheet);
    }
}
